package com.study.kt._04project.game_tank.model

import com.study.kt._04project.game_tank.Config
import com.study.kt._04project.game_tank.enums.Direction
import org.itheima.kotlin.game.core.Painter


/**
 * 子弹
 * 子弹的方向、位置信息由外界传入
 */
class Bullet_构造传值(private val direction: Direction, override var x: Int, override var y: Int) :
    View {
    override val width: Int = Config.block
    override val height: Int = Config.block

    override fun draw() {
        val imagePath: String = when (direction) {
            Direction.UP -> "img/bullet_u.gif"
            Direction.DOWN -> "img/bullet_d.gif"
            Direction.LEFT -> "img/bullet_l.gif"
            Direction.RIGHT -> "img/bullet_r.gif"
        }
        Painter.drawImage(imagePath, x, y)
    }
}